﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LabDayAtRaces
{
    public class Greyhound
    {
        public int StartingPosition; //Where MyPictureBox starts
        public int RacetrackLength; //How long the racetrack is
        public PictureBox MyPictureBox = null; //My PictureBox object
        public int Location = 0; // My Location on the racetrack
        public Random Randomizer; // An instance of Random
        public bool Run()
        {
            //Move forward either 1,2,3, or 4 spaces at random
            
                Location += Randomizer.Next(1, 4);

                //Update position of MyPictureBox on the form like this:
                MyPictureBox.Left = StartingPosition + Location;

                //test that this method was executed
                //MessageBox.Show("testing Hello World");
            

            if (Location > (RacetrackLength - MyPictureBox.Width))
            {
                // Return true if you win the race
                return true;
            }
            else { return false; }

        }
        public void TakeStartingPosition()
        {
            // Reset my location to 0 and MyPictureBox to starting position
            Location = 0;
            MyPictureBox.Left = 0;
        }
    }
}
